require([
    'jquery',
    'jquery.debounce',
    'jquery.query-object',
    'module/search',
    'requirejs/domready!'], 
function($) {
	var resizeHandler = function(){
		var w = $('.product-search').parent().width();
		$('.product-search').width(w);
	};
	
	// window resize handler
	$(window).resize($.debounce( 250, resizeHandler));
	resizeHandler();
	
	$('.product-search').on('click','.nav-pills > li > a', function(){
		$('#product-search-form input[name="category"]').val($(this).data('code'));
	});
	$('.nav-pills > li.active > a').trigger('click');
});